home *** CD-ROM | disk | FTP | other *** search
- Path: tank.news.pipex.net!pipex!swrinde!gatech!psinntp!psinntp!psinntp!pipeline!not-for-mail
- From: johndill@nyc.pipeline.com (John Dillworth)
- Newsgroups: comp.lang.c,
- Subject: Dispaly lines of Lines of file with Win 3.1 SDK
- Date: 9 Apr 1996 16:19:47 -0400
- Organization: Pipeline
- Message-ID: <4kegp3$d5p@pipe11.nyc.pipeline.com>
- NNTP-Posting-Host: pipe11.nyc.pipeline.com
- X-PipeUser: johndill
- X-PipeHub: nyc.pipeline.com
- X-PipeGCOS: (John Dillworth)
- X-Newsreader: Pipeline v3.5.0
-
- This is a fragment from a program included in the Microsoft development
- library and in Petzolds ôPrograming Windows 3.1. The MAXENV is defined as
- 4096. What this program does is display a box with the envirormental
- variables listed (PATH, PROMPT ect.....) When you click on one of these
- variables the actula PATH or PROMPT willl appear in a window above the box
- that shows the variables. My question: How do I modify this to do the
- same think for my config.sys file. I think that this can be done in real C
- (I refuse to accept that the developers of C could have imaged what Windows
- would do with it) Can I use a function called ôFileOen and FileClose?
- Will DrawText suffice to display?
-
-
-
-
-
- for (n = 0 ; environ[n] ; n++)
- {
- if (strlen (environ [n]) > MAXENV)
- continue ;
- *strchr (strcpy (szBuffer, environ [n]), '=') = '\0' ;
- SendMessage (hwndList, LB_ADDSTRING, 0,
- (LONG) (LPSTR) szBuffer) ;
- }
- return 0 ;
-
- case WM_SETFOCUS:
- SetFocus (hwndList) ;
- return 0 ;
-
- case WM_COMMAND:
- if (wParam == 1 && HIWORD (lParam) == LBN_SELCHANGE)
- {
- n = (WORD) SendMessage (hwndList, LB_GETCURSEL, 0, 0L)
- ;
- n = (WORD) SendMessage (hwndList, LB_GETTEXT, n,
- (LONG) (LPSTR) szBuffer) ;
-
- strcpy (szBuffer + n + 1, getenv (szBuffer)) ;
- *(szBuffer + n) = '=' ;
-
- SetWindowText (hwndText, szBuffer) ;
- }
- return 0 ;
-
- --
-
- John Dillworth
-